﻿using System.Collections.Generic;
using NExt.util;
using NExt.Core.Model.Base;

namespace NExt
{
    public class Component : Component<ComponentEvents>
    {
    }

    public abstract class Component<TEvents> : Observable<TEvents>
        where TEvents : ComponentEvents, new()
    {
        protected Component()
        {
            plugins = new List<object>();
            stateEvents = new List<string>();
        }

        public bool? allowDomMove { get; set; }
        public object applyTo { get; set; } //TODO: return value correct?
        public object autoEl { get; set; } //TODO: return value correct?
        public bool? autoShow { get; set; }
        public string clearCls { get; set; }
        public string cls { get; set; }
        public string ctCls { get; set; }
        public bool? disabled { get; set; }
        public string disabledClass { get; set; }
        public string fieldLabel { get; set; }
        public bool? hidden { get; set; }
        public bool? hideLabel { get; set; }
        public string hideMode { get; set; }
        public bool? hideParent { get; set; }
        public string itemCls { get; set; }
        public string labelSeparator { get; set; }
        public string labelStyle { get; set; }
        public string overCls { get; set; }
        public IList<object> plugins { get; set; } //TODO: return value correct?
        public object renderTo { get; set; } //TODO: return value correct?
        public IList<string> stateEvents { get; set; }
        public string stateId { get; set; }
        public bool? stateful { get; set; }
        public string style { get; set; }
    }

    public class ComponentEvents : ObservableEvents
    {
        public IScript afterrender { get; set; }
        public IScript beforedestroy { get; set; }
        public IScript beforehide { get; set; }
        public IScript beforerender { get; set; }
        public IScript beforeshow { get; set; }
        public IScript beforestaterestore { get; set; }
        public IScript beforestatesave { get; set; }
        public IScript destroy { get; set; }
        public IScript disable { get; set; }
        public IScript enable { get; set; }
        public IScript hide { get; set; }
        public IScript render { get; set; }
        public IScript show { get; set; }
        public IScript staterestore { get; set; }
        public IScript statesave { get; set; }
    }
}
